﻿$(document).ready(function () {

});

function AddNewRow() {
    gvUser.AddNewRow();
}

function Cancel() {
    gvUser.CancelEdit();
}

function Save() {
    gvUser.UpdateEdit();
}

var selectedIDs = [];
function gvUserBeginCallback(s, e) {
    ids = "";
    for (var index = 0; index < selectedIDs.length; index++) {
        ids += selectedIDs[index] + ",";
    }
    e.customArgs["selectedIDs"] = ids;
}

function Delete(id) {
    selectedIDs = gvUser.GetSelectedKeysOnPage();
    if (selectedIDs.length == 0) {
        alert("You must select at least one item.");
        return false;
    }

    var result = confirm("Are you sure you want to delete User?");
    if (result == true) {
        gvUser.DeleteRowByKey(selectedIDs[0]);
    }
}